Today I will share with you a special effect of love confession animation based on HTML5 Canvas. From a visual point of view, it is also a love contour, but the difference is that this love contour is composed of many beating little hearts, and it has a 3D effect. I like it You can use it.
Advertisement
var Point = (function() { function Point(x, y) { this.x = (typeof x !== 'undefined') ? x : 0; this.y = (typeof y !== 'undefined') ? y : 0; } Point.prototype.clone = function() { return new Point(this.x, this.y); }; Point.prototype.length = function(length) { if (typeof length == 'undefined') return Math.sqrt(this.x * this.x + this.y * this.y); this.normalize(); this.x *= length; this.y *= length; return this; }; Point.prototype.normalize = function() { var length = this.length(); this.x /= length; this.y /= length; return this; }; return Point; })();
html, body { height: 100%; padding: 0; margin: 0; background: #000; } canvas { width: 100%; height: 100%; }
Advertisement