aframevr / aframevr/aframe

setInterval on fillText method for Canvas on A-frame version 1.2.1

Open
#4,868 2 comments 0 reactions 0 assignees View on GitHub

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>
    WORKS -- <script src="https://aframe.io/releases/0.6.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); },

});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.