Wanted to share something I did at work over new years, I wanted to do a snowglobe shake effect. I used a bunch of methods but out QA app was really making it chug so I went trough a lot of versions with different engines. They all run fine on android, ios etc, it’s just within our environment they didn’t run so I ended up using GSAP’s pay for physics extension which isn’t really a physics library , but a small collection of scripts to simulate acceleration for div tags.
[Click on the icon to trigger it if you’re on desktop]
subaru_v2-physicsjs.zip (317.1 KB)
(you can up the snow count to hundreds, i just had it set to low so it works in our QA)
subaru_v3-matterjs.zip (315.3 KB)
subaru_v4-gsap-bare.zip (327.8 KB)
Unfortunately the GSAP file won’t have the library because it’s pay for but the scripts attaching to it are still there
But yeah I wanted to share in case anyone is wondering how to work with physics libraries within hype.
I also incorporated Shake.JS and DeviceApi Normaliser. The second because i originally had a way to detect the angle of the tablet so the snow tilts with the tablet. But yeah, lag(just in our app).
For the record
Easiest to use: PhysicsJS
Most Flexible: PhysicsJS
Ran the fastest: GSAP
(but again pseudo physics, does not use canvas)