setInterval on fillText method for Canvas on A-frame version 1.2.1
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 4.4k
- PR merge metrics
- No merged PRs in 30d
Description
Trying to setInterval on a canvas element to push text along using ctx.fillText() doesnt work when using version 1.2.0 but works when using version 0.6.0.
I did also use the tick function but didn't work there neither for version 1.2.1
-
A-Frame Version: 1.2.1
-
Platform / Device: Windows 10 Desktop
-
Reproducible Code Snippet or URL:
DOESNT WORK -- <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script> AFRAME.registerComponent('draw-canvas', { init: function () { var canvas = this.canvas = document.getElementById('canvas'); var ctx = this.ctx = this.canvas.getContext('2d'); this.w = this.canvas.width = document.body.offsetWidth; this.h = this.canvas.height = document.body.offsetHeight; this.cols = Math.floor(this.w / 20) + 1; this.ypos = Array(this.cols).fill(0); ctx.fillStyle = '#fff'; ctx.fillRect(5, 5, this.w, this.h); ctx.fillStyle = '#0f0'; ctx.font = '55pt monospace'; ctx.fillText('ssg', 533, 222); setInterval(function () { ctx.fillText('ssg', 533, 333); console.log(ctx) }, 5000); },
WORKS -- <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the inline draw-canvas component, especially init, ctx.fillText(), setInterval(), and the mentioned tick function. Reproduce the snippet with the A-Frame 1.2.0 and 0.6.0 script versions, then determine whether this is an A-Frame regression or a support/usage question. Done means a minimal reproducible finding and a clear fix or closure rationale.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100