Skip to content

Commit 2b93df2

Browse files
mihailgaberovmihailgaberov
mihailgaberov
authored and
mihailgaberov
committed
✨ Finished making a lotto blower effect.
1 parent 781cef4 commit 2b93df2

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

index.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// import Ball from './src/Ball'
33
import Matter from 'matter-js'
44

5-
const BALLS_COUNT = 45
5+
const BALLS_COUNT = 44
66

77
export default class App {
88
static init () {
@@ -29,16 +29,20 @@ export default class App {
2929
})
3030

3131
const balls = []
32+
const ballImagePaths = [
33+
'static/images/7.png',
34+
'static/images/7.png',
35+
]
3236

3337
const createBall = () => {
3438
const ball = Bodies.circle(
35-
render.canvas.width / 2,
39+
300,
3640
render.canvas.height / 2,
3741
20, {
3842
restitution: 1,
3943
render: {
4044
sprite: {
41-
texture: 'static/images/ball7b.png'
45+
texture: ballImagePaths[Math.round(Math.random() * 2)]
4246
}
4347
}
4448
})

src/Ball.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class Ball {
1010
this.xSpeed = 5;
1111
this.ySpeed = 5;
1212

13-
this.bitmap = new createjs.Bitmap('static/images/ball7b.png')
13+
this.bitmap = new createjs.Bitmap('static/images/7.png')
1414
this.bitmap.x = Math.floor(Math.random() * stageWidth)
1515
this.bitmap.y = Math.floor(Math.random() * stageHeight)
1616
this.bitmap.shadow = new createjs.Shadow('#00000', 5, 5, 10)
File renamed without changes.

0 commit comments

Comments
 (0)