Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:56:21+00:00 2026-06-13T09:56:21+00:00

I have a problem with KineticJS – there is no drag on my shape.

  • 0

I have a problem with KineticJS – there is no drag on my shape.

What is wrong with my code? – Iam really stuck and need somebody KineticJS-shark.

My code:

<!DOCTYPE HTML>
<html>
<head>

<script src="kinetic-v4.0.4.min.js"></script>
<script>
window.onload = function() {
var stage = new Kinetic.Stage({
container: "container",
width: 1024,
height: 768
});
var layer = new Kinetic.Layer();
var spaceShip = new Kinetic.Shape({

drawFunc: function (context) {

context.beginPath();
context.moveTo(99.3, 161.4);
context.bezierCurveTo(99.3, 143.2, 92.5, 128.4, 84.2, 128.4);
context.bezierCurveTo(83.6, 128.4, 83.1, 128.4, 82.6, 128.6);
context.bezierCurveTo(76.5, 84.1, 53.0, 8.0, 53.0, 8.0);
context.bezierCurveTo(53.0, 8.0, 29.6, 84.0, 23.5, 128.5);
context.bezierCurveTo(23.0, 128.4, 22.6, 128.4, 22.2, 128.4);
context.bezierCurveTo(13.8, 128.4, 7.0, 143.2, 7.0, 161.4);
context.bezierCurveTo(7.0, 179.6, 22.2, 228.9, 22.2, 228.9);
context.bezierCurveTo(22.2, 228.9, 27.2, 212.4, 31.5, 194.9);
context.bezierCurveTo(37.1, 206.7, 44.7, 213.9, 53.0, 213.9);
context.bezierCurveTo(61.5, 213.9, 69.1, 206.5, 74.7, 194.6);
context.bezierCurveTo(79.0, 212.2, 84.2, 228.9, 84.2, 228.9);
context.bezierCurveTo(84.2, 228.9, 99.3, 179.6, 99.3, 161.4);
context.closePath();
context.fillStyle = "rgb(203, 203, 203)";
context.fill();


context.bezierCurveTo(37.9, 97.3, 42.4, 92.8, 48.0, 92.8);
context.bezierCurveTo(53.7, 92.8, 58.2, 97.3, 58.2, 102.9);
context.closePath();
context.fillStyle = "rgb(255, 255, 255)";
context.fill();


},


});


// add the shape to the layer
layer.add(spaceShip);

// add the layer to the stage
stage.add(layer);

spaceShip.setDraggable(true);

spaceShip.on('dragstart', function() {
    console.log("Drag start");      
});

spaceShip.on('dragend', function() {
    console.log("Drag end");        
});




};
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>

(What more do you want me to write StackOverflow???)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:56:23+00:00Added an answer on June 13, 2026 at 9:56 am

    Try this below code

    <!DOCTYPE HTML>
    <html>
    <head>
    
        <script src="http://www.html5canvastutorials.com/libraries/kinetic-v4.0.3.js"></script>
    
        <script>
            window.onload = function() {
                var stage = new Kinetic.Stage({
                    container: "container",
                    width: 1024,
                    height: 768
                });
                var layer = new Kinetic.Layer();
    
                var spaceShip = new Kinetic.Shape({
                    drawFunc: function (context) {
                        context.beginPath();
                        context.moveTo(99.3, 161.4);
                        context.bezierCurveTo(99.3, 143.2, 92.5, 128.4, 84.2, 128.4);
                        context.bezierCurveTo(83.6, 128.4, 83.1, 128.4, 82.6, 128.6);
                        context.bezierCurveTo(76.5, 84.1, 53.0, 8.0, 53.0, 8.0);
                        context.bezierCurveTo(53.0, 8.0, 29.6, 84.0, 23.5, 128.5);
                        context.bezierCurveTo(23.0, 128.4, 22.6, 128.4, 22.2, 128.4);
                        context.bezierCurveTo(13.8, 128.4, 7.0, 143.2, 7.0, 161.4);
                        context.bezierCurveTo(7.0, 179.6, 22.2, 228.9, 22.2, 228.9);
                        context.bezierCurveTo(22.2, 228.9, 27.2, 212.4, 31.5, 194.9);
                        context.bezierCurveTo(37.1, 206.7, 44.7, 213.9, 53.0, 213.9);
                        context.bezierCurveTo(61.5, 213.9, 69.1, 206.5, 74.7, 194.6);
                        context.bezierCurveTo(79.0, 212.2, 84.2, 228.9, 84.2, 228.9);
                        context.bezierCurveTo(84.2, 228.9, 99.3, 179.6, 99.3, 161.4);
                        context.closePath();
                        this.fill(context);
                        this.stroke(context);
                    },
                    draggable:true,
                    fill: "#00D2FF",
                    stroke: "black",
                    strokeWidth: 1
                });
    
                // add the shape to the layer
                layer.add(spaceShip);
    
                // add the layer to the stage
                stage.add(layer);
    
                spaceShip.on('dragstart', function() {
                    console.log("Drag start");
                    document.getElementById("display").innerHTML = "Drag start";
                });
    
                spaceShip.on('dragend', function() {
                    console.log("Drag end");
                    document.getElementById("display").innerHTML = "Drag end";
                });
    
            };
        </script>
    
    </head>
    <body>
    <div id="container"></div>
    <div id="display"></div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with my code. I don't know what am I doing wrong.
I have problem to write data to file. What I'm doing wrong? SecTrustRef trust
i have problem with enum I need make a enum in base class or
I have problem with deserialize document to object using XmlSerializer class. Code my function
Have problem with this code var MAIN_LOCATION = http://www.bosscaffe.com/new/; $(#gallery_page).click(function() { $('#gallery_photos').show(); getPhotos(); return
I have problem to make work a resource file. This is my simple code
I have problem with passing variables through views. But, first some code // i
I have problem with search location in Google Map Android here is my code
I have problem with setting sqlite database file to auto shrink. The code I'm
i have problem concerning to XML and java.util.List. In my script Iam able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.