Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float centerY, centerX, offset, speed, angle;
- float baseAlpha;
- void setup() {
- size(400, 400);
- noStroke();
- centerY = height / 2;
- centerX = width / 2;
- offset = 127; // amplitude
- speed = 0.1;
- angle = 0;
- baseAlpha = 128;
- }
- void draw() {
- background(255); // clear canvas
- float alpha = baseAlpha + (sin(angle) * offset);
- fill(0, 0, 0, alpha);
- ellipse(centerX, centerY, 50, 50);
- angle += speed;
- }
Advertisement
Add Comment
Please, Sign In to add comment