Skip to content

Angular + Rive Text #59

@Wiesorium

Description

@Wiesorium

Issue request after this conversation on the rive discord group:

I was asking how to implement rive text with angular:

Me:
this works for me to set input and stuff

<canvas #riveCanvas id="canvas" [ngClass]="{'up': !focus, 'down': focus}" riv="edenaut_moon" width="1920" height="1080" >

<riv-input name="aura" [value]="this.playerData.pot_active">
<riv-input name="solar-robot-on-init" [value]="this.playerData.solar_robot">
<riv-input name="adam" [value]="this.playerData.adam">
<riv-input name="piaget-visible" [value]="this.playerData.piaget_visible" >
<riv-input name="tech-lab-visible" [value]="this.playerData.tech_lab_visible" >
<riv-input #trigger="rivInput" name="trigger-eden">

BUT

how to set text? tutorials didn't fit for me

i tried something like this but the canvas never showed up...

<canvas id="canvas" [ngClass]="{'up': !focus, 'down': focus}" width="1920" height="882">

with

import {Rive} from '@rive-app/canvas'
ngOnInit(): void {
this.r = new rive.Rive({
src: "edenaut_moon.riv",
canvas: document.getElementById("canvas"),
autoplay: true,
artboard:"Edenauts" ,
stateMachines: ["State Machine 1"],
onLoad: () => {
// then setting the text
}
}});

can anybody help me achieve that?

m_andrasch
Mh just an educated guess:

Seems like onLoad is not yet implemented in ng-rive API, at least it is not documented: https://github.com/dappsnation/ng-rive?tab=readme-ov-file#api

You could open an issue here
https://github.com/dappsnation/ng-rive/issues

Much success!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions