Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.js"></script>
- <script>
- var big = 10
- var x = 300
- var y = 300
- var speedx = 5
- var speedy = 3
- function setup() {
- createCanvas(600, 600)
- }
- function draw() {
- background(255,133,0)
- fill("black")
- ellipse(x, y, big, big)
- x = x + speedx
- y = y + speedy
- if (x >= 600 || x < 0) {
- speedx = -speedx
- } else if (y >= 600 || y < 0) {
- speedy = -speedy
- }
- }
- function mousePressed() {
- big = big + 15
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement