I have code which, when you look at an element, it moves. I achieve this using a-cursor with fuse="true". I want to make the fuseTimeout 100 milliseconds and I tried adding the following to the <a-cursor> element:
cursor="fuseTimeout: 100"
timeout="100"
fuseTimeout="100"
Here is the full code: https://jsfiddle.net/be1pgjyv/7/
Try fuse-timeout="100". The docs are off, will fix.
Related
A question about a-frame? Does aframe offer button objects (like a-button)? If yes, why are there no information about them in the documentation?
Are they planned to be added?
And if it isnt, is there a way to create objects in a-frame that behave like button that can be used on a touchscreen?
You can turn pretty much any a-frame object into a button.
make your cursors rayOrigin to your mouse. (You can add the cursor attribute to your camera)
<a-camera cursor="rayOrigin: mouse"></a-camera>
For example lets take an a-box primitive and turn it into a button by adding the standard onclick event to the element
<a-box onclick="doSomething"></a-box>
And initiate the function you want.
This should work for touch too.
If you want an overlay UI, I'd always go with HTML elements. They're easier to manage, as you can position them on the screen easily.
If you want the UI to track an object (like a marker in arjs), you can use my tracked-ui component as follows:
<!-- The HTML UI -->
<div id="ui"></div>
<a-scene arjs>
<a-marker tracked-ui="element: #ui; offset: 0 200">
<a-box></a-box>
</a-marker>
</a-scene>
I'm trying to build an A-Frame scene where a car drives by the user, and I need the sound of the car to start playing as the car starts moving. For example:
<a-collada-model id="car" src="#car-dae" position="-0.7 0 -100" rotation="0 90 0">
<a-animation attribute="position"
dur="7000"
begin="model-loaded"
fill="forwards"
to="-0.7 0 20"
repeat="0"
></a-animation>
</a-collada-model>
Can I put a sound component on the animation? If not, how should I go about having the sound play at the same time as the animation? I tried putting the sound component on the collada model and gave it a on:model-loaded (same event as the animation), but this never played the sound. In fact, the only way I seem to be able to get the sound to play is using autoplay. Any ideas?
If it helps, all of my code is in this git repo under carChase.html
https://github.com/zeekw/aFrameTests
Did you try putting the sound component on the model, or as a child of it?
<a-collada-model src="#car-dae" sound="on: model-loaded; src: #car-sound">
For example, I have some text "Hello" floating about in the scene, on mousing over it I want the text to change to "Hi"
Right now, when I try to use an animation, the text just disappears off, instead of changing.
Any help?
Thanks.
Here is an example using JavaScript to change text on mouseover.
Ignoring the boilerplate used to wait for the scene to load, the code is:
var someText = document.querySelector('#someText');
someText.addEventListener('mouseenter', mouseenter);
function mouseenter () {
someText.setAttribute('bmfont-text', 'text: Hi');
}
Where "someText" points to an entity with the bmfont-text component (though it would work for geometric text as well). This example uses Mayognaise's mouse cursor component but could easily be changed to a gaze-cursor.
-
Additionally, here is a CodePen demonstrating ngokevin's answer. I was going to post this as a comment to his answer, but I don't have enough reputation points...
I would use the event-set component (download the dist and drop into your project), not the animation tag:
<a-entity text="text: Hello" event-set="_event: mouseenter; text: Hi"></a-entity>
0.2.0 build: https://github.com/ngokevin/aframe-event-set-component/tree/v0.2.0/dist
0.3.0 build https://github.com/ngokevin/aframe-event-set-component/tree/master/dist
I have a pdf image inside the anchor tag.I need to get the element and with that I need to click on the pdf link. Tried with element by Id but getting element not visible but it is visible.Kindly help in getting the element through css,struck in this for nearly 2 days.
<div class="az content-block">
<ol>
<li>{{'check.ant.label'|text}}</li>
<li>{{'check.bed.label'|text}}</li>
<li>{{'check.hin.label'|text}}<a id="checkPdfLink" ng-href="{{check.pdf}}" target="_blank"><span class="az icon-pdf"></span></a></li>
</ol>
</div>
Did you try with css Selector? If it is hard to find a unique ID, try right click on the inspect element of the pdf link and click on Copy Unique Selector and try to click on it.
element(by.css('paste your Unique Selector here')).click();
Hope this helps. :)
In a simple case, this is just:
element(by.id("checkPdfLink")).click();
But, since you are getting the "Element not visible" error, there could be several reasons for that. One, is that you may need to actually do something to make the element visible - open up a menu, or a dropdown. The other reason, could be the timing problem. Wait for the link to become clickable before clicking:
var EC = protractor.ExpectedConditions;
var pdfLink = element(by.id("checkPdfLink"));
browser.wait(EC.elementToBeClickable(pdfLink), 5000); // wait up to 5 seconds
pdfLink.click();
I'm currently using DYI app builder platform and they have a <>source code page. So I put in
<img src="URL.png"/>
And it worked! But when I tried to shrink the image (original image is width=256 height 256)
<img src="URL.png" Width="100" Height="100"/>
Nothing happens to the size of the image.
So I tried
<div style="width:100px;height:100px;overflow:hidden;" >
<img src="URL.png" width="100px" height="auto">
</div>
Which I picked up on StackOverflow.. But it doesn't work.
Please help. BTW I have no knowledge of coding so please do not skip a step assuming I would know it.
(When I apply the code and go back to the source code page width and height disappeared from the source code page except the bare bone Img src="URL")
Something in your program is overriding it or disabling it (filtering it away). If it is another css rule that is overriding your css, then you could try:
width:100px !important;height:100px !important;
if this doesn't work then apparently the css gets filtered out, you might check the program's settings if this behavior can be changed
Try to save the page, in the DYI app builder you're using.