Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

p5.js not showing on safari

Hi, I've written this p5.js and put this on index.html.

This works perfectly fine on Chrome but for some reason the animation is really really really slow on safari. Also, this is making other css strange only on safari.

Does anyone know the reason? - attaching p5.js code below:

------------------(CODE BELOW)-----------------------------------------------------

var rectWidth; var rectHeight; var counter;

function setup() {

createCanvas(5120, 1000); rectWidth = 30; rectHeight = 100; counter = 0; rectMode(CENTER); // imageMode(CENTER); noStroke(); // img = loadImage('assets/pointing.png'); }

function draw() { background(0); fill(200); var gap = 150; for (var y = rectHeight; y < height; y+=gap) { for (var x = rectWidth; x < width; x+=gap) { push(); var dx = x - mouseX; var dy = y - mouseY; var angle = Math.atan2(dy, dx); translate(x, y); rotate(angle + Math.PI/2); // image(img, 0, 0); rect(0, 0, rectWidth, rectHeight); pop(); } } counter++; }