Multi-color Text using globalCompositeOperation
How do I make an multi-color text using globalcompositeoperation?
Animated mulit-color text using globalCompositeOperation. What is a multi-color text using globalcompositeoperation? How do you make a multi-color text using globalcompositeoperation? This script and codes were developed by Dave DeHaan on 04 January 2023, Wednesday.
Multi-color Text using globalCompositeOperation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Multi-color Text using globalCompositeOperation</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <center> <canvas id="draw" height="300" width="300"></canvas>
</center> <script src="js/index.js"></script>
</body>
</html>
Multi-color Text using globalCompositeOperation - Script Codes CSS Codes
canvas { background: #000;
}
body { background: #000; margin: 0px;
}
Multi-color Text using globalCompositeOperation - Script Codes JS Codes
/* START CONFIG VARS */
var displayText = 'hello world';
var textColor = '#FFF';
var textStyle = '40px Arial';
var circleColor = '#ACE';
var positionRadius = 30;
var animSpeed = 4;
/* END CONFIG VARS */
var c=document.getElementById("draw");
var ctx=c.getContext("2d");
var frame = 0;
setInterval(function() { frame++; c.width = 300; ctx.beginPath(); ctx.fillStyle = textColor; ctx.font = textStyle; ctx.fillText(displayText, 60, 140); ctx.globalCompositeOperation = 'xor'; ctx.fillStyle = circleColor; shiftX = Math.sin(frame / (360 / animSpeed) * Math.PI) * positionRadius; shiftY = Math.cos(frame / (360 / animSpeed) * Math.PI) * positionRadius; ctx.beginPath(); ctx.arc(150 + shiftX, 130 + shiftY, 50, 0, 2*Math.PI); ctx.fill(); ctx.beginPath(); ctx.arc(150 - shiftX, 130 - shiftY, 50, 0, 2*Math.PI); ctx.fill();
}, 1000/60);
Developer | Dave DeHaan |
Username | davedehaan |
Uploaded | January 04, 2023 |
Rating | 3 |
Size | 1,983 Kb |
Views | 10,120 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
404 Glitch Effect | 3,495 Kb |
More Fun with Lines | 3,118 Kb |
Merry Christmas. | 3,030 Kb |
Tween Bubbles. | 2,175 Kb |
Unblur on Page Load | 2,048 Kb |
A Pen by Dave DeHaan | 2,015 Kb |
Christmas Countdown | 2,133 Kb |
Fun with Lines | 2,897 Kb |
HTML5 Logo Tracing | 2,301 Kb |
Yule Logs | 1,496 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Simple Carousel Pure CSS | Dangvanthanh | 4,080 Kb |
Funny menu | AxeLVaisper | 4,671 Kb |
Reviews and Ratings Star | Zbnmstry | 1,591 Kb |
Mobile first social buttons with no iframe | Alistairtweedie | 3,158 Kb |
Glitchy Text Effect | Kescoe | 2,208 Kb |
Shopping List | Markmurray | 6,015 Kb |
P5.js data visualization | Enginarslan | 2,233 Kb |
Progressively reveal dots on a Bezier curve | GreenSock | 2,489 Kb |
Learning canvas drawing | Aurer | 2,204 Kb |
A Pen by boilzzz | Boilzzz | 2,761 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!