<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: hindrik40</title>
    <description>The latest articles on DEV Community by hindrik40 (@hindrik40).</description>
    <link>https://dev.to/hindrik40</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F379528%2F4b84f8c3-a3f0-4b8b-9e9c-41f5147b616a.png</url>
      <title>DEV Community: hindrik40</title>
      <link>https://dev.to/hindrik40</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hindrik40"/>
    <language>en</language>
    <item>
      <title>Stuck with draw()</title>
      <dc:creator>hindrik40</dc:creator>
      <pubDate>Wed, 07 Jul 2021 16:00:09 +0000</pubDate>
      <link>https://dev.to/hindrik40/stuck-with-draw-11m2</link>
      <guid>https://dev.to/hindrik40/stuck-with-draw-11m2</guid>
      <description>&lt;p&gt;I have a problem with the draw function in my tutorial. I'm following a video where I will do a game on canvas. When I made the projectile function/class and tried to draw it on the screen, I failed to show up. I can see it in the console but not on the net. Do anyone 'have a suggestion on what could be wrong. The js code is below. I would appreciate feedback!&lt;br&gt;
Here is the code:&lt;/p&gt;

&lt;p&gt;const canvas = document.querySelector("canvas");&lt;br&gt;
const ctx = canvas.getContext("2d");&lt;br&gt;
canvas.width = window.innerWidth / 2;&lt;br&gt;
canvas.height = window.innerHeight / 2;&lt;/p&gt;

&lt;p&gt;//Klasser&lt;br&gt;
// Klass player&lt;br&gt;
class Player {&lt;br&gt;
    constructor(x, y, radius, word, color) {&lt;br&gt;
        this.x = x&lt;br&gt;
        this.y = y&lt;br&gt;
        this.radius = radius&lt;br&gt;
        this.color = color&lt;br&gt;
        this.word = word&lt;br&gt;
    }&lt;br&gt;
    draw() {&lt;br&gt;
        ctx.beginPath()&lt;br&gt;
        ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false)&lt;br&gt;
        ctx.fillStyle = this.color&lt;br&gt;
        ctx.fill()&lt;br&gt;
        ctx.strokeStyle = "red"&lt;br&gt;
        ctx.stroke()&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;class Projectile {&lt;br&gt;
    constructor(x, y, radius, color, velocity) {&lt;br&gt;
        this.x = x&lt;br&gt;
        this.radius = radius&lt;br&gt;
        this.color = color&lt;br&gt;
        this.velocity = velocity&lt;br&gt;
    }&lt;br&gt;
    draw() {&lt;br&gt;
        ctx.beginPath()&lt;br&gt;
        ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false)&lt;br&gt;
        ctx.fillStyle = this.color&lt;br&gt;
        ctx.fill()&lt;br&gt;
            }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;const x = canvas.width / 2&lt;br&gt;
const y = canvas.height / 2&lt;br&gt;
const player = new Player(x, y, 30, "Hej", "blue", )&lt;br&gt;
player.draw()&lt;/p&gt;

&lt;p&gt;//Event listener&lt;/p&gt;

&lt;p&gt;addEventListener('click', (event) =&amp;gt; {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const projectile = new Projectile(event.clientX,
    event.clientY,
    5, 'red',
    null)

console.log(projectile)
projectile.draw()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;});&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Stuck among slides</title>
      <dc:creator>hindrik40</dc:creator>
      <pubDate>Mon, 15 Mar 2021 12:41:40 +0000</pubDate>
      <link>https://dev.to/hindrik40/stuck-among-slides-3lk8</link>
      <guid>https://dev.to/hindrik40/stuck-among-slides-3lk8</guid>
      <description>&lt;p&gt;`&lt;br&gt;
//föra bilderna fram och tillbaka&lt;/p&gt;

&lt;p&gt;//Funktion för att aktivera bildspelet&lt;/p&gt;

&lt;p&gt;function runSlideshow(){&lt;br&gt;
    let intervalId = setInterval(function () {&lt;br&gt;
        //Alla bilderna&lt;br&gt;
        let slideshowImages = document.querySelectorAll("#slideshow img");&lt;br&gt;
        //Sista bilden&lt;br&gt;
        let lastImage = slideshowImages[slideshowImages.length-1];&lt;br&gt;
       console.log("Tona ut bilden", lastImage);&lt;br&gt;
      let opacity =1;&lt;br&gt;
       let fadeOutId = setInterval(function () {&lt;br&gt;
           lastImage.style.opacity = opacity;&lt;br&gt;
           if (opacity&amp;gt;0) {&lt;br&gt;
               opacity-=0.01;&lt;br&gt;
           } else {&lt;br&gt;
               clearInterval(fadeOutId);&lt;br&gt;
               opacity = 1;&lt;br&gt;
           }&lt;br&gt;
       },1000/60);&lt;br&gt;
    },5000);&lt;br&gt;
    return intervalId;&lt;br&gt;
    function FadeOut(moveImage){&lt;br&gt;
        image.style&lt;br&gt;
    }&lt;/p&gt;

&lt;p&gt;};&lt;br&gt;
runSlideshow();&lt;br&gt;
runFadeout();&lt;br&gt;
runMoveImage();&lt;/p&gt;

&lt;p&gt;function moveImage(image){&lt;br&gt;
    image.remove();&lt;br&gt;
    slideshow.prepend(image);&lt;br&gt;
};&lt;br&gt;
Stuck again I can't get my slideshow to go around It doesn't fade correctly and all three pics don't rotate. Any suggestion?? I do have text to my slides but the text doesn't fade away either.&lt;br&gt;
 `&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Stuck in fetch JS</title>
      <dc:creator>hindrik40</dc:creator>
      <pubDate>Wed, 10 Mar 2021 10:26:33 +0000</pubDate>
      <link>https://dev.to/hindrik40/stuck-in-fetch-js-254h</link>
      <guid>https://dev.to/hindrik40/stuck-in-fetch-js-254h</guid>
      <description>&lt;p&gt;Hello, I'm new to Javascript and I'm stuck with my JS code.&lt;br&gt;
I used fetch to reach my info and got it when I console logit but can't place the pics on my Html page. The pics are stored in an Array and I think I should use a for each code but can't manage it.&lt;br&gt;
See my JS code below. If someone could give me a hint I would be very grateful.&lt;br&gt;
Thanks in advance Hindrik&lt;/p&gt;

&lt;p&gt;const button = document.querySelector("button");&lt;br&gt;
const header = document.querySelector("h2");&lt;br&gt;
button.addEventListener("click", () =&amp;gt; {&lt;br&gt;
    fetch("&lt;a href="http://172.104.246.137:8083/%22"&gt;http://172.104.246.137:8083/"&lt;/a&gt;)&lt;br&gt;
        .then(result =&amp;gt; result.json())&lt;br&gt;
        .then(data =&amp;gt; {&lt;br&gt;
            console.log(data);&lt;br&gt;&lt;br&gt;
        });     &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;});&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
