add SCALE const in simple_client

This commit is contained in:
Marc Planard 2024-08-19 10:56:33 +02:00
parent 578ce4320a
commit bc93c35999

View File

@ -10,6 +10,8 @@ use redis::{
use std::thread::sleep;
use std::time::{Duration, Instant};
const SCALE: f32 = 500.0;
fn do_something() -> redis::RedisResult<()> {
let client = Client::open("redis://127.0.0.1/")?;
let mut con: Connection = client.get_connection()?;
@ -23,7 +25,7 @@ fn do_something() -> redis::RedisResult<()> {
for i in 0..128 {
let a = (time + i as f32) / 128.0 * std::f32::consts::PI * 2.0;
let r = 4800.0 + (a * 5.0).cos() * (2000.0 * (time / 5.0).cos());
let r = 24.0 * SCALE + (a * 5.0).cos() * (10.0 * SCALE * (time / 5.0).cos());
let x = a.cos() * r;
let y = a.sin() * r;