Skip to main content
Inspiring
2月 20, 2022 4:15 午前 UTC
質問

HTML5 Canvas - Duplicate symbol, resize and change position in JavaScript

In HTML5 Canvas, how would you duplicate, resize and change position (all at once) of a graphic symbol in JavaScript?

 

So, the symbol to duplicate is `LensMagSymbolIcon`. Lets say I also want to resize that symbol 5 times, or to 279.3px wide and 318.65px high, and move to some X Y position.

 

This will be initiated by selecting an option from a ComboBox.

 

this.transformLens = function(){
//duplicate,resize and reposition stuff

}

if(!this.LensMagCombo_1_change_cbk) {
function LensMagCombo_1_change(evt) {
if(evt.target.value == '2.50'){
// Call duplicate and resize function
this.transformLens();
//
}
}
$("#dom_overlay_container").on("change", "#LensMagCombo_1", LensMagCombo_1_change.bind(this));
this.LensMagCombo_1_change_cbk = true;
}

 

    このトピックへの返信は締め切られました。

    返信数 1

    FlatChat作成者
    Inspiring
    2月 20, 2022 4:29 午前 UTC

    Just realised an easier way to do this rather than cloning a graphic symbol, and potentially adding heaps of them tothe library. which I don't want to do...  

     

    So given the limited number of symbols needed, I will just create them and move them off stage, to reapper on stage when required.

    翻訳